//
//  NSString+MethodSwizzling.m
//  Objective-C
//
//  Created by S_Line on 2018/8/2.
//  Copyright © 2018年 S_Line. All rights reserved.
//

#import "NSString+MethodSwizzling.h"

#import <objc/runtime.h>

@implementation NSString (MethodSwizzling)

+ (void)load {
    Method originalMethod = class_getInstanceMethod(self, @selector(lowercaseString));
    Method swizzlingMethod = class_getInstanceMethod(self, @selector(sl_lowercaseString));
    method_exchangeImplementations(originalMethod, swizzlingMethod);
}

- (NSString *)sl_lowercaseString {
    NSString *string = [self sl_lowercaseString];
    
    SLog(@"\nbefore: %@, \nafter: %@", self, string);
    
    return string;
}

@end
